<template>
  <div class="mine">
    <div class="namecard" @click="login">
      <div class="login">
        <i class="iconfont icon-shouji"></i>
      </div>
      <span>登陆 / 注册</span>
    </div>
    <van-grid :column-num="2">
      <van-grid-item
        :text="item.text"
        to="settings"
        v-for="(item, index) in pages"
        :key="index"
      >
        <template #icon>
          <van-icon
            class-prefix="iconfont"
            :name="item.name"
            :color="item.color"
            size="20px"
          />
        </template>
      </van-grid-item>
    </van-grid>
    <van-cell-group>
      <van-cell
        :title="item.title"
        is-link
        v-for="(item, index) in features"
        :key="index"
      />
    </van-cell-group>
    <van-tabbar
      :safe-area-inset-bottom="true"
      :placeholder="true"
      v-model="active"
    >
      <van-tabbar-item
        replace
        to="/login"
        icon-prefix="iconfont"
        icon="iconfont icon-shouye"
        >首页</van-tabbar-item
      >
      <van-tabbar-item
        replace
        to="/login"
        icon-prefix="iconfont"
        icon="iconfont icon-wenda"
        >问答</van-tabbar-item
      >
      <van-tabbar-item
        replace
        to="/login"
        icon-prefix="iconfont"
        icon="iconfont icon-shipin"
        >视频</van-tabbar-item
      >
      <van-tabbar-item
        replace
        to="/login"
        icon-prefix="iconfont"
        icon="iconfont icon-wode"
        >我的</van-tabbar-item
      >
    </van-tabbar>
  </div>
</template>

<script>
export default {
  name: 'Home',
  data() {
    return {
      active: 3,
      pages: [
        { text: '收藏', name: 'iconfont icon-shoucang', color: 'red' },
        { text: '历史', name: 'iconfont icon-lishi', color: 'green' }
      ],
      features: [
        { title: '消息通知', path: 'settings' },
        { title: '小智同学', path: 'mine' }
      ]
    }
  },
  computed: {},
  methods: {
    login() {
      this.$router.push({ path: 'login' })
    }
  },
  mounted() {}
}
</script>

<style scoped lang="less" >
::v-deep .van-grid .bgc .van-grid-item__content,
::v-deep .van-grid .bgc .van-grid-item__content span,
::v-deep .van-grid .bgc [class*='van-hairline']::after,
[class*='van-hairline']::after {
  background-color: rgba(0, 0, 0, 0) !important;
  color: #fff;
  border: none !important;
}
.namecard {
  width: 100%;
  height: 300px;
  background: url(../../assets/banner.png) no-repeat;
  background-size: cover;
  position: relative;
  .login {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    width: 150px;
    height: 150px;
    background-color: #fff;
    text-align: center;
    line-height: 150px;
    border-radius: 50%;
    i {
      color: rgb(69, 159, 249);
      font-size: 80px;
    }
  }
  span {
    position: absolute;
    top: 72%;
    left: 50%;
    transform: translate(-50%);
    font-size: 40px;
    color: #fff;
  }
}
</style>
